package com.cdqidi.core.weixinmanager.domain;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cdqidi.util.page.BaseQuery;
import com.cdqidi.valid.group.DefaultGroup;
import com.cdqidi.valid.group.DeleteGroup;
import com.cdqidi.valid.group.UpdateGroup;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;

/**
 * 微信公众平台管理
 *
 * @author sjk
 */
@EqualsAndHashCode(callSuper = true)
@Getter
@Setter
public class OrgWxConfigDTO extends BaseQuery {

    @ExcelIgnore
    @JsonIgnore
    private static final String EXCEL_TITLE = "微信公众平台管理";
    /**
     * 主键
     */
    @ExcelProperty(value = {EXCEL_TITLE, "应用ID"})
    @NotBlank(message = "应用ID不能为空", groups = {DeleteGroup.class, UpdateGroup.class})
    @Size(max = 200, message = "应用ID长度不能超过{max}位", groups = {DeleteGroup.class, UpdateGroup.class})
    private String appId;
    /**
     * 名称
     */
    @ExcelProperty(value = {EXCEL_TITLE, "名称"})
    @NotBlank(message = "名称不能为空", groups = DefaultGroup.class)
    @Size(max = 200, message = "名称长度不能超过{max}位", groups = DefaultGroup.class)
    private String appName;
    /**
     * 令牌
     */
    @ExcelProperty(value = {EXCEL_TITLE, "令牌"})
    @Size(max = 200, message = "令牌长度不能超过{max}位", groups = DefaultGroup.class)
    private String token;
    /**
     * 应用密钥
     */
    @ExcelProperty(value = {EXCEL_TITLE, "应用密钥"})
    @Size(max = 200, message = "应用密钥长度不能超过{max}位", groups = DefaultGroup.class)
    private String appSecret;
    /**
     * 消息是否加密
     */
    @ExcelIgnore
    private Boolean encryptMessage;
    /**
     * 消息加解密密钥
     */
    @ExcelIgnore
    @Size(max = 200, message = "消息加解密密钥长度不能超过{max}位", groups = DefaultGroup.class)
    private String encodeAesKey;
    /**
     * 介绍
     */
    @ExcelIgnore
    @Size(max = 500, message = "介绍长度不能超过{max}位", groups = DefaultGroup.class)
    private String remark;
    /**
     * 安全文件
     */
    @ExcelIgnore
    private String security;
    /**
     * 安全文件名称
     */
    @ExcelProperty(value = {EXCEL_TITLE, "安全文件名称"})
    @Size(max = 200, message = "安全文件名称长度不能超过{max}位", groups = DefaultGroup.class)
    private String securityFileName;
    /**
     * 商户号
     */
    @ExcelProperty(value = {EXCEL_TITLE, "商户号"})
    @Size(max = 32, message = "商户号长度不能超过{max}位", groups = DefaultGroup.class)
    private String mchId;
    /**
     * API秘钥
     */
    @ExcelProperty(value = {EXCEL_TITLE, "商户秘钥"})
    @Size(max = 32, message = "商户秘钥长度不能超过{max}位", groups = DefaultGroup.class)
    private String apiKey;
    /**
     * 证书
     */
    @ExcelIgnore
    private String certificate;
    /**
     * 添加时间
     */
    @ExcelProperty(value = {EXCEL_TITLE, "添加时间"})
    @NotNull(message = "添加时间不能为空", groups = DefaultGroup.class)
    private LocalDateTime addTime;
    /**
     * 更新时间
     */
    @ExcelProperty(value = {EXCEL_TITLE, "更新时间"})
    private LocalDateTime updateTime;
    /**
     * 微信账号分类
     */
    @ExcelIgnore
    @NotBlank(message = "微信账号分类不能为空", groups = DefaultGroup.class)
    @Size(max = 20, message = "微信账号分类长度不能超过{max}位", groups = DefaultGroup.class)
    private String wxAccountType;
    /**
     * 微信账号分类显示
     */
    @ExcelProperty(value = {EXCEL_TITLE, "微信账号分类"})
    private String wxAccountTypeDisplay;
    /**
     * 机构ID
     */
    @ExcelIgnore
    @NotBlank(message = "机构ID不能为空", groups = DefaultGroup.class)
    @Size(max = 50, message = "机构ID长度不能超过{max}位", groups = DefaultGroup.class)
    private String orgId;
    /**
     * 机构名称
     */
    @ExcelIgnore
    private String orgIdDisplay;
    /**
     * 操作人
     */
    @ExcelIgnore
    @NotBlank(message = "操作人不能为空", groups = DefaultGroup.class)
    @Size(max = 50, message = "操作人长度不能超过{max}位", groups = DefaultGroup.class)
    private String operator;
    /**
     * 操作人名称
     */
    @ExcelIgnore
    private String operatorDisplay;

    private Integer type;

    @Override
    public void freeData() {
        this.appId = null;
        this.appName = null;
        this.token = null;
        this.appSecret = null;
        this.encryptMessage = null;
        this.encodeAesKey = null;
        this.remark = null;
        this.security = null;
        this.securityFileName = null;
        this.mchId = null;
        this.apiKey = null;
        this.certificate = null;
        this.addTime = null;
        this.updateTime = null;
        this.wxAccountType = null;
        this.wxAccountTypeDisplay = null;
        this.orgId = null;
        this.orgIdDisplay = null;
        this.operator = null;
        this.operatorDisplay = null;
        super.freeData();
    }
}
